home *** CD-ROM | disk | FTP | other *** search
-
- /* BootTime INIT
- ⌐ Mike Gleason Jr.
- version 4.0 January 14, 1991. */
-
- #include "setupA4.h"
-
-
- /* constants to test GetKeys() with */
- #define d_key 5
- #define option_key 61
- #define spacebar_key 54
-
-
-
- #pragma mark _prototypes
- void main(void);
- void DoIt(void);
-
- struct
- {
- char privates[76];
- long randSeed;
- BitMap screenBits;
- Cursor arrow;
- Pattern dkGray;
- Pattern ltGray;
- Pattern gray;
- Pattern black;
- Pattern white;
- GrafPtr thePort;
- } *qdPtr; /* Size of QD Globals is 206 bytes. */
-
-
-
- void main(void)
- {
- KeyMap k;
- Handle h;
-
- RememberA0();
- SetUpA4();
-
- /* this and all the asm{} is by David Allcott of Symantec.
- Thanks David! */
- asm
- { ;guarantee that INIT is locked even
- _RecoverHandle ;if locked bit was not set with ResEdit
- move.l a0,h ;save away handle to unlock later
- _HLock ;handle is already in a0
-
- clr.l 0x0a6c ;location of DeskHook low mem global
- ;DeskHook is not cleared at init time on
- ;all machines. it is cleared by
- ;Multifinder after inits run.
- ;If you display a window and move
- ;or dispose of it, the OS attempts to
- ;redraw the desktop behind it, and calls
- ;the deskhook (or attempts to call it)
- ;if the low mem global is non-zero.
-
- clr.l 0x09f6 ;location of DragHook
- ;same scenario as DeskHook (MJG)
-
- link a5,#(-300); ;space for the Quickdraw globals
- move.l a5, CurrentA5 ;we now have our own A5 world
- pea -4(a5)
- _InitGraf
- }
- InitFonts();
- InitWindows();
- InitDialogs(0L);
- InitPack(bdConv);
-
- GetKeys(&k);
- if (!(Button() || BitTst(&k, option_key) || BitTst(&k, spacebar_key)))
- DoIt();
- /* if you hold the option key or spacebar down, I won't load. */
-
- asm
- {
- unlk a5;
- move.l a5, CurrentA5; /* Restore the previous A5. */
- }
- HUnlock(h);
- DisposHandle(h);
- RestoreA4();
- }
-
-
-
-
-
- void DoIt(void)
- {
- Rect r;
- register Str255 a = "\p", b;
- register long tyme, min, secs;
- long tix;
- #define DELAYTIX 90
-
-
- /* get the time elapsed since the machine was turned on,
- in minutes:seconds.fractionOfSecond form. */
-
- tyme = TickCount();
- tix = ((tyme - ((tyme / 60) * 60)) * 100) / 60;
- min = tyme / 3600;
- secs = (tyme - (min * 3600)) / 60;
-
- if (min)
- {
- NumToString(min, a);
-
- (*a)++; *(a + *a) = ' ';
- (*a)++; *(a + *a) = 'm';
- (*a)++; *(a + *a) = 'i';
- (*a)++; *(a + *a) = 'n';
- (*a)++; *(a + *a) = ' ';
- }
-
- NumToString(secs, b);
- (*a)++; *(a + *a) = *(b+1);
- if (secs > 9)
- {
- (*a)++; *(a + *a) = *(b+2);
- }
-
- (*a)++; *(a + *a) = '.';
- NumToString(tix, b);
- if (tix < 10)
- {
- (*a)++; *(a + *a) = '0';
- (*a)++; *(a + *a) = *(b+1);
- }
- else
- {
- (*a)++; *(a + *a) = *(b+1);
- (*a)++; *(a + *a) = *(b+2);
- }
-
- (*a)++; *(a + *a) = ' ';
- (*a)++; *(a + *a) = 's';
- (*a)++; *(a + *a) = 'e';
- (*a)++; *(a + *a) = 'c';
-
- TextFont(0);
- TextSize(12);
-
- SetRect(&r,
- 10,
- 30,
- 10 + StringWidth(a) + 18,
- 56
- );
-
- EraseRect(&r);
- FrameRect(&r);
- InsetRect(&r, 2, 2);
- FrameRect(&r);
-
- MoveTo(r.left + 7, r.top + 16);
- DrawString(a);
-
- tix = TickCount() + DELAYTIX;
- do
- {
- if (Button()) break;
- }
- while (TickCount() < tix);
- }
-